import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { JstAfterSaleOrderVO, JstAfterSaleOrderForm, JstAfterSaleOrderQuery } from '@/api/jdAndJstSceneClassification/consignmentSale/jstAfterSaleOrder/types';
import {
  listJdDirectTransferOrderByShopName
} from '@/api/jdAndJstSceneClassification/consignmentSale/jdDirectTransferOrder';

/**
 * 查询聚水潭-售后单列表
 * @param query
 * @returns {*}
 */

export const listJstAfterSaleOrder = (query?: JstAfterSaleOrderQuery): AxiosPromise<JstAfterSaleOrderVO[]> => {
  return request({
    url: '/dataCheck/jst/afterSaleOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询聚水潭-售后单列表
 * 01、定义后端接口
 * @param query
 * @returns {*}
 */

export const listJstAfterSaleOrderByShopName = (query?: JstAfterSaleOrderQuery): AxiosPromise<JstAfterSaleOrderVO[]> => {
  return request({
    url: '/dataCheck/jst/afterSaleOrder/list-by-shop-name1',
    method: 'get',
    params: query
  });
};


/**
 * 查询聚水潭-售后单详细
 * @param id
 */
export const getJstAfterSaleOrder = (id: string | number): AxiosPromise<JstAfterSaleOrderVO> => {
  return request({
    url: '/dataCheck/jst/afterSaleOrder/' + id,
    method: 'get'
  });
};

/**
 * 新增聚水潭-售后单
 * @param data
 */
export const addJstAfterSaleOrder = (data: JstAfterSaleOrderForm) => {
  return request({
    url: '/dataCheck/jst/afterSaleOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改聚水潭-售后单
 * @param data
 */
export const updateJstAfterSaleOrder = (data: JstAfterSaleOrderForm) => {
  return request({
    url: '/dataCheck/jst/afterSaleOrder/jstAfterSaleOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除聚水潭-售后单
 * @param id
 */
export const delJstAfterSaleOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/dataCheck/jst/afterSaleOrder/jstAfterSaleOrder/' + id,
    method: 'delete'
  });
};
